"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const redux_1 = require("@tarojs/redux");
const taro_1 = require("@tarojs/taro");
const taro_ui_1 = require("taro-ui");
const components_1 = require("@tarojs/components");
const YContentPadded_1 = require("../../components/YContentPadded");
const YTableDivider_1 = require("../../components/YTableDivider");
const goods_1 = require("../../actions/goods");
require("./Winnings.scss");
let GoodsWinnings = class GoodsWinnings extends taro_1.Component {
    constructor() {
        super(...arguments);
        this.config = {
            navigationBarTitleText: '中奖名单',
            enablePullDownRefresh: true,
            backgroundColor: '#ccc'
        };
        this.state = {
            isOpened: false
        };
        this.onClick = (msg) => {
            console.log(msg, 123);
        };
    }
    componentWillMount() {
        this.props.fetchUsers({ isWinning: true }, data => {
            console.log(data, '123');
        });
    }
    onPullDownRefresh() {
        console.log('--------下拉刷新-------');
        taro_1.default.showNavigationBarLoading(); //在标题栏中显示加载
        setTimeout(() => {
            // complete
            taro_1.default.hideNavigationBarLoading(); //完成停止加载
            taro_1.default.stopPullDownRefresh(); //停止下拉刷新
        }, 2000);
    }
    onReachBottom() {
        this.setState(state => (Object.assign({}, state, { isOpened: true })));
        console.log('--------上拉刷新-------');
        setTimeout(() => {
            taro_1.default.stopPullDownRefresh(); //停止下拉刷新
            this.setState(state => (Object.assign({}, state, { isOpened: false })));
        }, 2000);
    }
    render() {
        return (<components_1.View className='GoodsUserProfile'>
        <taro_ui_1.AtToast isOpened={this.state.isOpened} text='加载中...' status='loading' hasMask={true}/>
        <YTableDivider_1.default title='奖品一：阳澄湖大闸蟹'/>
        <YContentPadded_1.default>
          <taro_ui_1.AtList>
            {Array.from(new Array(3)).map((i, k) => (<taro_ui_1.AtListItem key={k} thumb='https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png' extraThumb='https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png' extraText='+56' note='2018/08/02' title='张晓东'/>))}
          </taro_ui_1.AtList>
        </YContentPadded_1.default> 
        <YTableDivider_1.default title='奖品二：潜江小龙虾套餐'/>
        <YContentPadded_1.default>
          <taro_ui_1.AtList>
            {Array.from(new Array(6)).map((i, k) => (<taro_ui_1.AtListItem key={k} thumb='https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png' extraThumb='https://img12.360buyimg.com/jdphoto/s72x72_jfs/t6160/14/2008729947/2754/7d512a86/595c3aeeNa89ddf71.png' extraText='+56' note='2018/08/02' title='张明明'/>))}
          </taro_ui_1.AtList>
        </YContentPadded_1.default>       
      </components_1.View>);
    }
};
GoodsWinnings = __decorate([
    redux_1.connect(({ goods }) => ({
        goods
    }), (dispatch) => ({
        fetchUsers(params, callback) {
            dispatch(goods_1.queryUsers(params, callback));
        }
    }))
], GoodsWinnings);
exports.default = GoodsWinnings;
//# sourceMappingURL=Winnings.jsx.map